# This Python file uses the following encoding: utf-8
import sys
import PySide6.QtCore
from PySide6 import QtWidgets
from PySide6.QtWidgets import QApplication, QWidget, QPushButton, QLabel
from PySide6.QtGui import QIcon
from PySide6.QtCore import Slot
from PySide6.QtCore import *


@Slot(QLabel)
def say_hello(labelx):
    # print("Button clicked, Hello!")
    labelx.setText("您好小蜘蛛！")


class button(QWidget):
    def __init__(self):
        QWidget.__init__(self)


if __name__ == "__main__":
    app = QApplication([])

    window = button()
    window.setWindowIcon(QIcon('img/Search.ico'))
    window.setWindowTitle("开软网络爬虫项目")
    window.setFixedSize(600, 400)  # 设置窗口固定大小

    main_widget = QtWidgets.QWidget()
    main_layout = QtWidgets.QVBoxLayout()

    labelQ = QLabel("亲爱的 老公想你了")
    labelQ.setAttribute(PySide6.QtCore.Qt.WA_StyledBackground, True)
    labelQ.setStyleSheet('background-color: red; font-size:40px;')
    labelQ.setAlignment(PySide6.QtCore.Qt.AlignCenter)
    buttonQ = QPushButton("Click me")
    buttonQ.clicked.connect(lambda: say_hello(labelQ))

    main_layout.addWidget(labelQ)
    main_layout.addWidget(buttonQ)

    window.setLayout(main_layout)

    window.show()
    sys.exit(app.exec())
